<html xmlns:th="http://www.thymeleaf.org" xmlns:x="http://www.w3.org/1999/html">
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="babyRecordEditForm" method="post">
            <table class="grid">
                <input name="id" type="hidden" th:value="${babyRecord.id}">
                <tr>
                    <td></td>
                    <td><input name="id" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.id}"></td>
                    <td></td>
                    <td><input name="day" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.day}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="height" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.height}"></td>
                    <td></td>
                    <td><input name="weight" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.weight}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="other" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.other}"></td>
                    <td></td>
                    <td><input name="accessDay" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.accessDay}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="accessDaytime" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.accessDaytime}"></td>
                    <td></td>
                    <td><input name="accessType" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.accessType}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="description" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.description}"></td>
                    <td></td>
                    <td><input name="attentionMatter" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.attentionMatter}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="foods" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.foods}"></td>
                    <td></td>
                    <x:select id="babyRecordEditStatus" name="status" type="dbStatus" class="easyui-combobox"
                              data-options="width:160,height:29,editable:false,panelHeight:'auto'"/>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="updateTime" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.updateTime}"></td>
                    <td></td>
                    <td><input name="createTime" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.createTime}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input name="picturePath" type="text" placeholder="请输入" class="easyui-validatebox"
                               data-options="required:true" th:value="${babyRecord.picturePath}"></td>
                </tr>
            </table>
            </table>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $('#babyRecordEditForm').form({
            url: basePath + '/babyRecord/edit',
            onSubmit: function () {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success: function (result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.code === 1) {
                    //之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为list页面预定义好了
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    var form = $('#babyRecordEditForm');
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });

        $("#babyRecordEditStatus").val('[[${babyRecord.status}]]');
    });
</script>
